<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <title>导出筛选</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../static/css/style.css" media="all">
    <script type="text/javascript" src="../../static/js/jquery.min.js"></script>
    <script src="../../layui/layui.all.js" charset="utf-8"></script>
    <script src="../../static/js/base.js" charset="utf-8"></script>
    <script src="../../static/js/ax.js"></script>
    <script src="../../static/js/jquery.cookie.js"></script>
    <script src="../../static/js/avalon.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="../../static/js/html5.js"></script>
    <script src="../../static/js/respond.js"></script>
    <![endif]-->
</head>

<body class="bg_w">

    <div class="layui-fluid" ms-controller="test2">
        <div class="content-wrap">
            <form class="layui-form layui-form-pane" id="from1">
                <div class="layui-row layui-col-space15">
                    <div class="layui-col-lg3 layui-col-sm6">
                        <label class="layui-form-label">关键字
                        </label>
                        <div class="layui-input-block">
                            <input type="text" name="searchKey" id="depName" value="" class="layui-input code" placeholder="学员姓名或证件号码">
                        </div>
                    </div>
                    <div class="layui-col-lg3 layui-col-sm6">
                        <label class="layui-form-label">时间
                        </label>
                        <div class="layui-input-block">
                            <input type="datetime" id="enrolltime" class="layui-input" placeholder="yyyy-MM-dd HH:mm:ss">
                        </div>
                    </div>
                    <div class="layui-col-lg3 layui-col-sm6">
                        <label class="layui-form-label">省份
                            <span class="red">*</span>
                        </label>
                        <div class="layui-input-block">
                            <select lay-filter="provinceSelect" id='driverprovinceId' lay-verify="required">
                                <option value="">请选择</option>
                                <option ms-attr="{value: el.id}" ms-for="($index, el) in @provlist">{{el.name}}</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-col-lg3 layui-col-sm6">
                        <label class="layui-form-label">市区
                            <span class="red">*</span>
                        </label>
                        <div class="layui-input-block">
                            <select lay-filter="regionSelect" id='drivercityId' lay-verify="required" name="cityCode">
                                <option value="">请选择</option>
                                <option ms-attr="{value: el.code}" ms-for="($index, el) in @citylist">{{el.name}}</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-col-lg3 layui-col-sm6">
                        <label class="layui-form-label">驾校
                        </label>
                        <div class="layui-input-block">
                            <select name="driverSchoolId">
                                <option value="0">请选择</option>
                                <option ms-attr="{value: el.id}" ms-for="($index, el) in @infolist">{{el.name}}</option>
                            </select>
                        </div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn add_btn btn-left" lay-submit lay-filter="addNews">导出</button>
                    </div>
                </div>
            </form>
        </div>
    </div>


</body>
<script>
    var form;
    var vm = avalon.define({
        $id: "test2",
        divisionId: '',
        cityid: '',
        fromTime: '',
        toTime: '',
        provlist: [],
        citylist: [],
        arealist: [],
        infolist: [],
        pro_city_are: {},
        //  查询省市区
        getRegionTree: function () {
            $.ajax({
                url: '../../static/js/addreess.text',  //文件地址
                type: 'GET',     //数据传递方式
                async: false,
                success: function (data) {  //获取数据成功执行的函数
                    var data = JSON.parse(data);
                    var city = data.city;
                    var area = data.area;
                    vm.provlist = data.prove;
                    vm.pro_city_are = data;
                    for (var i in city) {
                        if (city[i].parentId == data.prove[0].id) {
                            vm.citylist.push(city[i])
                        }
                    }
                    vm.cityid = city[0].id;
                    vm.getinfolist();
                    form.render('select');

                }
            })
        },
        //获取该市下面的驾校
        getinfolist: function () {
            ax.get({
                url: backendWebUrl + '/api/common/queryDriverSchool',
                contentType: "application/x-www-form-urlencoded",
                data: { "ids": vm.cityid },
                success: function (r) {
                    vm.infolist = (r.data);
                    form.render('select');
                },
            });
        },


    })
    vm.$watch('onReady', function () {
        //获取省市区
        vm.getRegionTree();
        console.log(111)

    })

    layui.use(['table', 'form', 'laydate', 'layer', 'upload'], function () {
        form = layui.form;
        var laydate = layui.laydate,
            layer = layui.layer,
            $ = layui.jquery,
            upload = layui.upload;

        laydate.render({
            elem: '#enrolltime'
            , range: true,
            done: function (value, date, date2) {
                console.log(date)
                vm.fromTime = date.year + '-' + date.month + '-' + date.date + ' 00:00:00';
                vm.toTime = date2.year + '-' + date2.month + '-' + date2.date + ' 00:00:00';


            }
        });

        //省改变
        form.on('select(provinceSelect)', function (data) {
            vm.provinceid = data.value;
            var city = vm.pro_city_are.city;
            vm.citylist.clear();
            for (var i in city) {
                if (city[i].parentId == vm.provinceid) {
                    vm.citylist.push(city[i])
                }
            }
            vm.cityid = vm.citylist[0].id;
            vm.getinfolist();
            form.render('select');

        });
        // 市改变
        form.on('select(regionSelect)', function (data) {
            vm.cityid = data.value;
            vm.getinfolist();

        });


        form.on("submit(addNews)", function (data) {
            // var index = layer.msg('数据提交中，请稍候', {icon: 16, time: false, shade: 0.8});
            var datas = data.field;
            datas.fromTime = vm.fromTime;
            datas.toTime = vm.toTime;

            window.location.href=backendWebUrl + systemhl + "/api/student/review/export?cityCode="+datas.cityCode+'&driverSchoolId='+datas.driverSchoolId+'&searchKey='+datas.searchKey+'&fromTime='+datas.fromTime+'&toTime='+datas.toTime + "&" + ax.getParamStr();
            layer.closeAll("iframe");
                    //刷新父页面
            // parent.location.reload();
            return false;
            
        });

    })
</script>

</html>